package com.kern.academic.config;

import com.kern.academic.interceptor.AuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *  配置认证拦截器
 * Created by caoshi at 8:01 2021-06-29
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInterceptor())
                .addPathPatterns("/**")           // 保护, 需验证token
                .excludePathPatterns("/login", "/captcha", ""); // 放行
    }
}
